home *** CD-ROM | disk | FTP | other *** search
- #include "amiga.h"
- #include <errno.h>
- #include <string.h>
- #include <unistd.h>
-
- void perror(const char *s)
- {
- char *err;
- char amiga_err[81];
-
- if (s && *s) {
- __write(2, s, strlen(s));
- __write(2, ": ", 2);
- }
- if (errno > 0 && errno <= sys_nerr)
- err = sys_errlist[errno];
- else if (errno == -1) {
- if (Fault(_OSERR, NULL, amiga_err, 81))
- err = amiga_err;
- else
- err = "42"; /* Shouldn't appear ... */
- } else
- err = "Unknown error code";
-
- __write(2, err, strlen(err));
- __write(2, "\n", 1);
- }
-